local skel = fk.CreateSkill {
  name = "emo__yanxing",
}

Fk:loadTranslationTable{
  ["emo__yanxing"] = "雁行",
  [":emo__yanxing"] = "每轮开始时，体力上限为四的其他角色可以用“陷阵”替代其所有技能并令你摸一张牌。",

  ["#emo__yanxing-ask"] = "雁行：你可以用“陷阵”替代所有技能并令 %src 摸一张牌。",

  ["$emo__yanxing1"] = "攻无不克，战无不胜！",
  ["$emo__yanxing2"] = "破阵斩将，易如反掌！",
}

skel:addEffect(fk.RoundStart, {
  anim_type = "support",
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and table.find(player.room.alive_players, function (p)
      return p.maxHp == 4 and p ~= player
    end)
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    local room = player.room
    for _, p in ipairs(room:getOtherPlayers(player)) do
      if p:isAlive() and p.maxHp == 4 and not p:hasSkill("emo__xianzhen", true) then
        if room:askToSkillInvoke(p, {skill_name = skel.name, prompt = "#emo__yanxing-ask:"..player.id }) then
          local skills = {"emo__xianzhen"}
          for _, s in ipairs(p:getSkillNameList()) do
            table.insert(skills, "-" .. s)
          end
          room:handleAddLoseSkills(p, skills)
          if not player.dead then
            player:drawCards(1, skel.name)
          end
        end
      end
    end
  end,
})

return skel
